#pragma once

#include <iostream>
#include <fstream>
using namespace std;

#include "cli.h"

#define NO_ROTATION 0
#define CW_ROTATION 1
#define CCW_ROTATION 2

class Map
{
private:
	char ** m_data;
	int m_width, m_height;
public:
	int m_x, m_y;
	Map();
	Map(char * a_filename);
	//TODO constructor from file with x and y parameters
	~Map();
	//return the position that the character was found at or
	//NULL if the file did not load correctly, or there was no position
	bool load(char * a_filename);
	void load(ifstream &a_source);
	void draw();
	void draw(int a_x, int a_y);
	int getHeight();
	int getWidth();
	int getX();
	int getY();
	void setX(int a_x);
	void setY(int a_y);
	void setXY(int a_x, int a_y);
	void addX(int a_x);
	void addY(int a_y);
	void release();
	void drawFlippedH(int x, int y);
	void drawFlippedV(int x, int y);
	void drawFlippedXY(int x, int y);
	void drawRotatedCW(int x, int y);
	void drawRotatedCCW(int x, int y);
	void flipH();
	void flipV();
	void flipXY();
	void rotateCW();
	void rotateCCW();
	bool overlaps(char a_myValue, char a_hisValue, Map & a_otherMap);
	void mergeWithBaseMap(char a_myValue, char a_hisValue, Map & a_baseMap);
	bool handleInput(Map & a_otherMap, char a_input);
	bool isNull();
	void operator=(Map & a_otherMap);
	bool collisionDetection(Map & a_otherMap, int oldX, int oldY, int howWeRotated); 
	char getValue(int row, int col);
	void eraseRow(int row);
};